#!/bin/bash

# centos9 docker install
#
# dnf update -y
# sudo dnf install -y dnf-utils
# sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# sudo dnf install -y docker-ce docker-ce-cli containerd.io
# or: sudo dnf install --allowerasing -y docker-ce docker-ce-cli containerd.io
# sudo systemctl start docker
# sudo systemctl status docker
# optional: sudo usermod -aG docker $USER
# optional: docker run hello-world
#
# fedora
#
# sudo dnf install docker-ce docker-ce-cli containerd.io -y
#
# https://get.docker.com/

# 使用yum安装docker
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo  https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# yum-config-manager --add-repo  https://mirrors.aliyun.com/docker-ce/linux/fedora/docker-ce.repo
yum install docker-ce -y
systemctl enable docker
systemctl start docker

# 配置docker加速镜像
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://eh3x8cdp.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker
